<% @page_title = "List of book rules" %>
<%= stylesheet_link_tag "admin/list-items", :media => "all" %>
<div class="list-users">
	<h1>List of book rules</h1>
	<table>
		<tr>
			<th>ID</th>
			<th>Reader group</th>
			<th>Max number of books</th>
			<th>Max day to borrow</th>
			<th>Max day to extend</th>
			<th>Punish money</th>
			<th>Action</th>
		</tr>
		<% order = 0 %>
		<% @borrow_rules.each do |borrow_rule| %>
			<tr <% if order % 2 == 0 %><%= "class='alt'" %><% end %> ><% order += 1 %>
				<td><%= borrow_rule.id %></td>
				<td><%= link_to Role.getRoleName(borrow_rule.role_id), :action => 'view', :id => borrow_rule.id %></td>
				<td><%= borrow_rule.max_book %></td>
				<td><%= borrow_rule.borrow_time %></td>
				<td><%= borrow_rule.extended_time %></td>
				<td><%= borrow_rule.punish_money %></td>
				<td class='action'>
					<%= link_to image_tag('icons/view-icon.png'), :controller => "admin/borrow_rule", :action => "view", :id => borrow_rule.id %>&nbsp;
					<%= link_to image_tag('icons/edit-icon.png'), :controller => "admin/borrow_rule", :action => "edit", :id => borrow_rule.id %>&nbsp;
					<%= link_to image_tag('icons/delete-icon.png'), {:controller => "admin/borrow_rule", :action => "delete", :id => borrow_rule.id}, :method => "delete", :data => {:confirm => "Are you sure?"} %>
				</td>
			</tr>
		<% end %>
	</table>
	<div class='paginator' style='margin-left:100px'><%= will_paginate @borrow_rules %></div>
</div><!-- End .list-borrow-rules -->